import axios from 'axios';
import uitl from '../common/js/util';
let base = 'common';
let axios_config = {responseType: 'json'};

export const get_file_blob = params => {

    return  axios.post(`${base}/get_file_blob`, params);
};


/**
 * 上传图片
 * @params file
 * @params roleType
 * @params roleId
 * @return
 *      status
 *      msg
 *      datas
 *          id
 * **/
export const update_img = params => {

    return  axios.post(`${base}/upload`, params);
};

/**
 * 获取图片地址
 * @param params
 * @returns {*|void}
 */
export const get_update_img = params => {

    return  axios.post(`${base}/images`, params);
};

/**
 * 上传文件
 * @params file
 * @params roleType
 * @params roleId
 * @return
 *      status
 *      msg
 *      datas
 *          id
 * **/
export const upload_file = params => {

    //return  axios.post(`${base}/upload`, params, 'application/x-www-form-urlencoded');
    return  axios.post(`${base}/upload_file`, params, 'multipart/form-data');
};

/**
 * 获取访问资源地址
 * @params file
 * @params roleType
 * @params roleId
 * @return
 *      status
 *      msg
 *      datas
 *          id
 * **/
export const getResourceUrl = params => {

    return  axios.post(`${base}/resource_url`, params);
};

//获取图片地址
export const get_file = params =>{
    return axios.post(`${base}/get_file`,params);
}


//获取文件地址地址
export const getFile = params =>{
    return axios.post(`${base}/get_file_url`,params);
}


/**
 * 判断文件是否存在
 */
export function isExistFile(filepath){

}

